#include<p18f4550.h>
#include<plib/delays.h>
char UNO[8]={255,255,250,0,0,254,255,255};
char DOS[8]={255,126,56,156,204,224,242,255};
char TRES[8]={255,123,248,236,236,0,19,255};
char CUATRO[8]={255,207,199,211,0,0,0223,255};
char CINCO[8]={255,97,96,236,236,12,29,255};
char SEIS[8]={255,15,6,210,216,28,61,255};
char SIETE[8]={255,253,28,12,229,241,249,255};
char OCHO[8]={255,19,0,239,236,0,19,255};
char NUEVE[8]={255,227,192,220,92,1,131,255};
char CERO[8]={255,3,0,252,252,1,3,255};

    int a=0, ct,i=0;


void main() {
 ADCON1=15;
    TRISC=1111;
    TRISB=0x00;TRISD=0x00;
    while(1){
        PORTD=1;
 if(PORTC==0){
      for(ct=0;ct<8;ct++){

                for (a = 0; a < 8; a++) {
                    PORTB = UNO[a];
                    Delay1KTCYx(1);
                    LATD <<= 1;
                }
                Delay1KTCYx(20);
                PORTD = 1;}
 }
 else if(PORTC==1){

      for(ct=0;ct<8;ct++){

                for (a = 0; a < 8; a++) {
                    PORTB = DOS[a];
                    Delay1KTCYx(1);
                    LATD <<= 1;
                }
                Delay1KTCYx(20);
                PORTD = 1;}
 }
else if(PORTC==2){

      for(ct=0;ct<8;ct++){

                for (a = 0; a < 8; a++) {
                    PORTB = TRES[a];
                    Delay1KTCYx(1);
                    LATD <<= 1;
                }
                Delay1KTCYx(20);
                PORTD = 1;}
 }
        else if(PORTC==4){

      for(ct=0;ct<8;ct++){

                for (a = 0; a < 8; a++) {
                    PORTB = CUATRO[a];
                    Delay1KTCYx(1);
                    LATD <<= 1;
                }
                Delay1KTCYx(20);
                PORTD = 1;}
 }
        else if(PORTC==5){

      for(ct=0;ct<8;ct++){

                for (a = 0; a < 8; a++) {
                    PORTB = CINCO[a];
                    Delay1KTCYx(1);
                    LATD <<= 1;
                }
                Delay1KTCYx(20);
                PORTD = 1;}
 }
        else if(PORTC==6){

      for(ct=0;ct<8;ct++){

                for (a = 0; a < 8; a++) {
                    PORTB = SEIS[a];
                    Delay1KTCYx(1);
                    LATD <<= 1;
                }
                Delay1KTCYx(20);
                PORTD = 1;}
 }
        else if(PORTC==8){

      for(ct=0;ct<8;ct++){

                for (a = 0; a < 8; a++) {
                    PORTB = SIETE[a];
                    Delay1KTCYx(1);
                    LATD <<= 1;
                }
                Delay1KTCYx(20);
                PORTD = 1;}
 }
        else if(PORTC==9){

      for(ct=0;ct<8;ct++){

                for (a = 0; a < 8; a++) {
                    PORTB = OCHO[a];
                    Delay1KTCYx(1);
                    LATD <<= 1;
                }
                Delay1KTCYx(20);
                PORTD = 1;}
 }
         else if(PORTC==10){

      for(ct=0;ct<8;ct++){

                for (a = 0; a < 8; a++) {
                    PORTB = NUEVE[a];
                    Delay1KTCYx(1);
                    LATD <<= 1;
                }
                Delay1KTCYx(20);
                PORTD = 1;}
 }

    }}



